﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Encog.ML.Data.Basic;

namespace IntObl
{
    public partial class InputData : Form
    {


        public Form1 form;
        public static String[] tickerSymbols = {
            "GE","MSFT", "GOOG","AAPL","INTC"
        };

        /*
        public InputData()
        {
            InitializeComponent();
        }

         */

        public InputData(Form1 form)
        {
            this.form = form;


            InitializeComponent();


            checkedListBox1.Items.AddRange(tickerSymbols);
            
           
        }



        private void okButton_Click(object sender, EventArgs e)
        {

            var set = new BasicMLDataSet();


            List<String> companies = new List<string>();

           foreach(String s in  checkedListBox1.CheckedItems){

               companies.Add(s);
           }
       
            DateTime from = fromDate.Value;
            DateTime to = toDate.Value;
          


            form.Util.BearPercent = -0.1;
            form.Util.BullPercent = 0.1;
            //form.Util.EvalWindow = 20;
            form.Util.PredictWindow = 20;

            form.Util.EvalWindow = Convert.ToInt32(evalWindowTextBox.Text);
            form.Util.PredictWindow = form.Util.EvalWindow ;

            foreach (String ticker in companies)
            {
                MessageBox.Show("start loading data for " + ticker + "...");
                form.Util.LoadCompany(ticker.Trim(), set, from, to);
            }

            MessageBox.Show("Dane pobrane.");


            form.Training = set;
            Hide();


        }

        private void label3_Click(object sender, EventArgs e)
        {

        }

     


    

    
    }
}
